package org.mwielocha.jxcube.ut;

public class Utilities {

  public static String formatSeconds(int input) {
    int h = input / 3600;
    int min = input / 60;
    int sec = input % 60;
    
    String result = "";
    if(h > 0) {
      result = h + ":";
    }
    
    if(min > 0) {
      result = result + min + ":";
    }

    result = result + sec;
    
    return result;
  }
  
  public static String formatTime(String time) {
    if(time == null) {
      return time;
    }
    
    if(time.startsWith("0:0:")) {
      return time.substring(4, time.length());
    } else if (time.startsWith("0:")) {
      return time.substring(2, time.length());
    } else {
      return time;
    }
  }
}
